<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Rails::AppRailsLoader</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Module</span> 
            Rails::AppRailsLoader 
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/railties/lib/rails/app_rails_loader_rb.html">railties/lib/rails/app_rails_loader.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AppRailsLoader.html#method-c-exec_app_rails">exec_app_rails</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>F</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AppRailsLoader.html#method-c-find_executable">find_executable</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">RUBY</td>
            <td>=</td>
            <td class="attr-value">File.join(*RbConfig::CONFIG.values_at(&quot;bindir&quot;, &quot;ruby_install_name&quot;)) + RbConfig::CONFIG[&quot;EXEEXT&quot;]</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">EXECUTABLES</td>
            <td>=</td>
            <td class="attr-value">['bin/rails', 'script/rails']</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">BUNDLER_WARNING</td>
            <td>=</td>
            <td class="attr-value">&lt;&lt;EOS
Looks like your app's ./bin/rails is a stub that was generated by Bundler.

In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.

Here's how to upgrade:

bundle config --delete bin    # Turn off Bundler's stub generator
rake rails:update:bin         # Use the new Rails 4 executables
git add bin                   # Add bin/ to source control

You may need to remove bin/ from your .gitignore as well.

When you install a gem whose executable you want to use in your app,
generate it and add it to source control:

bundle binstubs some-gem-name
git add bin/new-executable

EOS</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-exec_app_rails">
            
              <b>exec_app_rails</b>()
            
            <a href="AppRailsLoader.html#method-c-exec_app_rails" name="method-c-exec_app_rails" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-exec_app_rails_source')" id="l_method-c-exec_app_rails_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/85de18307127d740d32c42093d39b859a1335eb3/railties/lib/rails/app_rails_loader.rb#L29" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-exec_app_rails_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/app_rails_loader.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">exec_app_rails</span>
  <span class="ruby-identifier">original_cwd</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>

  <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">exe</span> = <span class="ruby-identifier">find_executable</span>
      <span class="ruby-identifier">contents</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">exe</span>)

      <span class="ruby-keyword">if</span> <span class="ruby-identifier">contents</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/(APP|ENGINE)_PATH/</span>
        <span class="ruby-identifier">exec</span> <span class="ruby-constant">RUBY</span>, <span class="ruby-identifier">exe</span>, *<span class="ruby-constant">ARGV</span>
        <span class="ruby-keyword">break</span> <span class="ruby-comment"># non reachable, hack to be able to stub exec in the test suite</span>
      <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">exe</span>.<span class="ruby-identifier">end_with?</span>(<span class="ruby-string">'bin/rails'</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">contents</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">'This file was generated by Bundler'</span>)
        <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-constant">BUNDLER_WARNING</span>)
        <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value">:APP_PATH</span>, <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">'config/application'</span>, <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>))
        <span class="ruby-identifier">require</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">'../boot'</span>, <span class="ruby-constant">APP_PATH</span>)
        <span class="ruby-identifier">require</span> <span class="ruby-string">'rails/commands'</span>
        <span class="ruby-keyword">break</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-comment"># If we exhaust the search there is no executable, this could be a</span>
    <span class="ruby-comment"># call to generate a new application, so restore the original cwd.</span>
    <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">original_cwd</span>) <span class="ruby-keyword">and</span> <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>).<span class="ruby-identifier">root?</span>

    <span class="ruby-comment"># Otherwise keep moving upwards in search of a executable.</span>
    <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-string">'..'</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-find_executable">
            
              <b>find_executable</b>()
            
            <a href="AppRailsLoader.html#method-c-find_executable" name="method-c-find_executable" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-find_executable_source')" id="l_method-c-find_executable_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/85de18307127d740d32c42093d39b859a1335eb3/railties/lib/rails/app_rails_loader.rb#L57" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-find_executable_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/app_rails_loader.rb, line 57</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">find_executable</span>
  <span class="ruby-constant">EXECUTABLES</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">exe</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">exe</span>) }
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                        </div>

    </div>
  </body>
</html>    